/*
  PWM示例呼吸灯
*/
int breath_v = 0;
int breath_d = 1;

void setup(){
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop(){
  breath_led();
}

void breath_led(){
  breath_v += breath_d;
  if(breath_v > 255 || breath_v < 0){ // 实际可设置的有效范围 0-255
    breath_d *= -1;
    breath_v += breath_d;
  }
  analogWrite(LED_BUILTIN, breath_v); //模拟信号输出
  delay(1); // 这个延时酌情调整
}
